﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using WPFExcelReport.Helpers;
using System.Data;
using WPFExcelReport;
using INTEX.SCHEDULER;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for Machine.xaml
    /// </summary>

    public partial class TSHAV13
    {
     
        public DateTime Start;
        public double AW = 0;
        public TSHAV13()
        {
            InitializeComponent();
           
        }
     
        public void GetCalendarPosition(ITXDateTime date)
        {
            StartPoint = Convert.ToInt32(date.StartDateTime.Subtract(Start).TotalHours + 1);
            if (StartPoint < 1)
                StartPoint = 1;

            if (date.StartDateTime < Start)//比五天前还要早
            {
                GRIDS = Convert.ToInt32(date.EndDateTime.Subtract(Start).TotalHours + 1);
            }
            else
            {
                GRIDS = Convert.ToInt32(date.EndDateTime.Subtract(date.StartDateTime).TotalHours + 1);
            }
            if (GRIDS < 24)
                GRIDS = 24;
            if (date.StartDate == "0")
                GRIDS = 1;
            //this.Processed.Width = continus * 30;
            StartPoint = Convert.ToInt32(StartPoint);
                        
            //this.SetValue(Grid.RowProperty, 0);
            //this.SetValue(Grid.ColumnProperty, GridColumn);
            //this.SetValue(Grid.ColumnSpanProperty, GridColumContinues);
        }
        public override void SetUp()
        {
             switch (JobType)
            {

                case "X":
                    imgProgress.Visibility = Visibility.Collapsed;
                    imgCalendar.Visibility = Visibility.Visible;
                    break;
                case "P":
                case "S":
                case "C":
                default:
                    imgProgress.Fill =JBrush;
                    imgCalendar.Visibility = Visibility.Collapsed;
                    imgProgress.Visibility = Visibility.Visible;
                    break;

            } 
        }         
        
    }
}
